package com.homework5_7.TestTable;

import com.homework5_7.mapper.OneToOneMapper;
import com.homework5_7.bean.Card;
import com.homework5_7.utils.MyBatisUtils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.InputStream;
import java.util.List;


public class Test01 {
    @Test
    public void selectAll() throws Exception{
        SqlSession sqlSession = MyBatisUtils.getSqlSession();

        //4.获取OneToOneMapper接口的实现类对象
        OneToOneMapper mapper = sqlSession.getMapper(OneToOneMapper.class);

        //5.调用实现类的方法，接收结果
        List<Card> list = mapper.selectAll();

        //6.处理结果
        for (Card c : list) {
            System.out.println(c);
        }

        //7.释放资源
        sqlSession.close();

    }
}
